home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / JFC.bin / MacArrowIcon.java < prev    next >
Text File  |  1998-06-30  |  2KB  |  87 lines

  1. /*
  2.  * @(#)MacArrowIcon.java    1.2 98/01/30
  3.  *
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  *
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  *
  19.  */
  20.  
  21. package com.sun.java.swing.plaf.mac;
  22.  
  23. import java.awt.*;
  24. import java.awt.event.*;
  25. import com.sun.java.swing.*;
  26. import com.sun.java.swing.border.*;
  27. import com.sun.java.swing.plaf.*;
  28.  
  29. import java.io.Serializable;
  30.  
  31. import com.sun.java.swing.plaf.basic.BasicSpinnerUI;
  32. import com.sun.java.swing.plaf.basic.Spinner;
  33.  
  34.  
  35.  
  36. /**
  37.  * An icon that draws an up or down arrow.
  38.  *
  39.  * @version 1.0 01/20/98
  40.  */
  41. public class MacArrowIcon implements Icon {
  42.  
  43.     private boolean up = true;
  44.     
  45.     public MacArrowIcon(boolean up) {
  46.         this.up = up;
  47.     }
  48.     
  49.    /**
  50.      * Paints the arrow
  51.      */
  52.     public void paintIcon(Component c, Graphics g, int x, int y)
  53.         {
  54.         g.setColor(Color.black);
  55.         g.translate((x),y+1);
  56.  
  57.         if (up) 
  58.             {
  59.             g.drawLine(0,-2,0,-2);
  60.             g.drawLine(-1,-1,1,-1);
  61.             g.drawLine(-2, 0, 2,0);
  62.             g.drawLine(-3, 1, 3, 1);
  63.             } 
  64.         else
  65.             {
  66.             g.drawLine(0,1,0,1);
  67.             g.drawLine(-1,0,1,0);
  68.             g.drawLine(-2, -1, 2,-1);
  69.             g.drawLine(-3, -2, 3, -2);
  70.             }
  71.  
  72.         g.translate(-(x), -(y+1));
  73.         }
  74.     
  75.     /**
  76.      * stubbed to satisfy the interface.
  77.      */
  78.     public int getIconWidth() { return 0; }
  79.  
  80.     /**
  81.      * stubbed to statify the interface.
  82.      */
  83.     public int getIconHeight()  { return 0; }
  84.  
  85. }
  86.  
  87.